close all;
clear;

% product_name = 'GF3_Jiayuguang_000077';
% work_folder = ['/home/storageSDA1/wenghs/Project/GammaUtils/GF3_Jiayuguang/', product_name, '/'];
% dem_par_path = [work_folder, product_name, '_resamp.dem_par'];
% fine_gtc_path = [work_folder, product_name, '.gtc'];
% gtc_tif_path = [product_name, '_gtc.tif'];

% fine_gtc_path = "/home/storageSDA1/wenghs/Project/GammaUtils/pipe02_gengtc/GF3_Jiayuguang_000075.gtc";
% dem_par_path = "/home/storageSDA1/wenghs/Project/GammaUtils/pipe02_gengtc/GF3_Jiayuguang_000075_resamp.dem_par";
% gtc_tif_path = "/home/storageSDA1/wenghs/Project/GammaUtils/pipe02_gengtc/GF3_Jiayuguang_000075_gamma_dom.tif";

fine_gtc_path = "/home/storageSDA1/wenghs/Project/GammaUtils/GF3_Jiayuguang/DOM/GF3_Jiayuguang_000076_000075/GF3_Jiayuguang_000076.gtc";
dem_par_path = "/home/storageSDA1/wenghs/Project/GammaUtils/GF3_Jiayuguang/DOM/GF3_Jiayuguang_000076_000075/GF3_Jiayuguang_000076_resamp.dem_par";
gtc_tif_path = "/home/storageSDA1/wenghs/Project/GammaUtils/GF3_Jiayuguang/DOM/GF3_Jiayuguang_000076_000075/GF3_Jiayuguang_000076_gamma_dom.tif";

[gtc_img, gtc_param] = gamma.gtc2geotiff(fine_gtc_path, dem_par_path, gtc_tif_path);

img = hsUtils.stretchImageByHist(gtc_img, 2000, "HistHalfPerc", 0.001);
img = uint8(img * 255);
geotiffwrite(gtc_tif_path, img, gamma.demParam2refer(gtc_param));

figure;
imagesc(img);
axis equal;
axis tight;
colormap(hs.img.color.cmap.cm_tempo);
